#pragma once

#include <math/Rect.h>
#include <math/Vector2.h>
#include <vector>

namespace liba {
namespace lib3d {
namespace hard {

class VertexBuffer;

// Constructs vertex buffer from series of rectangles
class VertexBufferBuilder2D
{
public:
	void SetZ(float value) { this->z = value; }
	void SetTextureSize(int width, int height) { this->texWidth = width; this->texHeight = height; }
	void SetTextureSize(math::Vector2<int> v) { this->SetTextureSize(v.x, v.y); }
	void AddRect(math::Rect<float> rect, math::Rect<int> texRect);

	void UpdateVertexBuffer(VertexBuffer* vb);
private:
	float z;
	int texWidth, texHeight;
	std::vector<float> positions;
	std::vector<float> uvs;
};

} // namespace hard
} // namespace lib3d
} // namespace liba